<?php
/**
 * // +----------------------------------------------------------------------
 * //            -------------------------
 * //           /   / ------------------\  \
 * //                                          \  \
 * //                                           /  /
 * //          /  /  ------------------- /  /
 * //        /  /  ----------------------
 * //      /  /
 * //      \  \
 * //        \  \  ------------------ /  /
 * //          \  \--------------------/
 * // +----------------------------------------------------------------------
 * // | Copyright (c) 2016 Sage  All rights reserved.
 * // +----------------------------------------------------------------------
 * // | Author: Sage
 * // +----------------------------------------------------------------------
 *
 */

/**
 * Created by PhpStorm.
 * User: Sage
 * Date: 2017/11/25
 * Time: 15:23
 */
namespace KysbsUtils;
require dirname(__FILE__).DIRECTORY_SEPARATOR.'../env/env.php';
if(RUN_ENV!=='PRODUCE' && RUN_ENV!=='DEV' && RUN_ENV!=='TEST'){
        exit('网站维护中...');
}

class Config {

    //环境变量,DEV(开发环境),TEST(测试),STRESS(压测,暂不支持),PRODUCE(生产)
    const ENV = RUN_ENV;
    //项目版本号
    const VERSION = '1.0.0';
    //订单自动关闭时间，单位：秒，当前：3分钟
    const ORDER_CLOSE_INTERVAL = 180;
    //Redis链接配置
    const REDIS_OPTIONS = [
        'host' => '127.0.0.1' ,
        'port' => '6379' ,
        'auth' => '' ,
    ];
    const MYSQL_CONFIG=self::ENV=='PRODUCE'?self::MYSQL_CONFIG_PRODUCE:
        (self::ENV=='TEST'?self::MYSQL_CONFIG_TEST:self::MYSQL_CONFIG_DEV);

    //mysql连接配置-dev
    const MYSQL_CONFIG_DEV= [
        'DB_HOST'   => '192.168.1.116' , // 服务器地址，内网
        'DB_DATABASE'   => 'db_kysbs' , // 数据库名
        'DB_USERNAME'   => 'root' , // 用户名
        'DB_PASSWORD'    => 'root123' , // 密码
        'DB_PORT'   => 8066 , // 端口
        'DB_PREFIX' => '' , // 数据库表前缀
        'DB_CHARTSET'=>'utf8mb4',
        'DB_COLLATION'=>'utf8mb4_unicode_ci'
    ];

    //mysql连接配置-test
    const MYSQL_CONFIG_TEST= [
        'DB_HOST'   => '172.16.52.160' , // 服务器地址，内网
        'DB_DATABASE'   => 'db_kysbs' , // 数据库名
        'DB_USERNAME'   => 'mycatwriter' , // 用户名
        'DB_PASSWORD'    => 'mycat.writer888123' , // 密码
        'DB_PORT'   => 8066 , // 端口
        'DB_PREFIX' => '' , // 数据库表前缀
        'DB_CHARTSET'=>'utf8mb4',
        'DB_COLLATION'=>'utf8mb4_unicode_ci'
    ];
    //mysql连接配置-produce
    const MYSQL_CONFIG_PRODUCE= [
        'DB_HOST'   => '172.16.228.252' , // 服务器地址，内网
        'DB_DATABASE'   => 'db_kysbs' , // 数据库名
        'DB_USERNAME'   => 'mycatwriter' , // 用户名
        'DB_PASSWORD'    => 'mycat.writer123666' , // 密码
        'DB_PORT'   => 8066 , // 端口
        'DB_PREFIX' => '' , // 数据库表前缀
        'DB_CHARTSET'=>'utf8mb4',
        'DB_COLLATION'=>'utf8mb4_unicode_ci'
    ];
    //第三方配置-OSS存储 key & secret & endpoint
    const OSS_KEY_ID='qvd4Gq3vV4iD8AVo';
    const OSS_KEY_SECRET='FF1jcLoVROlJtfyWoIdLgscfwCqT1e';
    const OSS_ENDPOINT='http://oss-cn-shanghai.aliyuncs.com';

    //第三方平台配置
    const OPEN_PLATFORM_APP=self::ENV=='PRODUCE'?
        self::OPEN_PLATFORM_APP_PRODUCE: self::OPEN_PLATFORM_APP_TEST;

    //第三方平台-test
    const OPEN_PLATFORM_APP_TEST=[
        'app_id'   => 'wx2b69f12d190d4fcf',
        'secret'   => '1f9a6ceba042a668c25d9223882611e6',
        'token'    => 'd5872dfbddbddeed26ab054c8e7d25c5',
        'aes_key'  => 'd5872dfbddbddee5c5d5872dfbddbddee22222132s2'
    ];


    //第三方平台-produce
    const OPEN_PLATFORM_APP_PRODUCE=[
        'app_id'   => 'wx54acb1659d3dbb33',
        'secret'   => 'bf94edac64f858895a1bfd44f50fb111',
        'token'    => 'd5872dfbddbddeed26ab054c8e7d25c5',
        'aes_key'  => 'd5872dfbddbddee5c5d5872dfbddbddee22222132s2'
    ];

    //暂存路径
    const TMP_STORAGE=DIRECTORY_SEPARATOR.'tmp';

    //开发环境Referer标识
    const DEV_REFERER='kysbs-dev';
}